#include <mFS/FsTypes.h>
#include <Utils/Mem.h>
#include <apdu/APDUParse.h>
#include <apdu/SwCode.h>
#include <apdu/CryptSessionAP.h>
#include <cmd/CMDCryptSession.h>


void CMDCryptSession_DestroySessionKey(void)
{
	ApduCmd *pCmd;
	UINT16 nRet;

	pCmd = APDU_GetCmd();

	if(pCmd->CLA != 0x80)
	{
		APDU_SetRespond(0, ISOSW_CLA_ERROR);
		return ;
	}

	if(pCmd->LC != 6)
	{
		APDU_SetRespond(0, ISOSW_LC_ERROR);
		return ;
	}

	if(pCmd->P1 != 0 || pCmd->P2 != 0)
	{
		APDU_SetRespond(0, ISOSW_P1P2_ERROR);
		return ;
	}

	nRet = CryptSessionAP_DestroySessionKey(pCmd->pData);

	APDU_SetRespond(0, nRet);

	return ;
}
